import wepy from 'wepy'
const baseUrl = 'https://www.zhengzhicheng.cn/api/public/v1'

// 定义一个获取数据失败，弹出无图标的消息框
wepy.baseToast = function(str = '获取数据失败') {
  wepy.showToast({
    title: str,
    icon: 'none',
    duration: 1500
  })
}

//发送get请求，url必须以/开头
wepy.get = function(url, data = {}) {
  return wepy.request({
    url: baseUrl + url,
    method: 'get',
    data
  })
}

wepy.post = function(url, data = {}) {
  return wepy.request({
    url: baseUrl + url,
    method: 'post',
    data
  })
}
